package day08.test2;

public class test2 {
    public static void main(String[] args) {
        Npc npc = new Npc();
        npc.print();
        npc.x = 100;
        npc.y = 200;
        npc.print();

        npc = null;
        System.out.println(npc);
    }
}
//讲一个游戏中npc的数据进行抽象化，抽取数据以及方法
class Npc {
    String name = "小鳄鱼";
    int x,y,w,h;
    String img;
    public void shift()
    {
        x++;
    }
    public void print()
    {
        System.out.println("x坐标"+x);
        System.out.println("Y坐标"+y);
        System.out.println("图片为"+img);

    }
}
